package com.darkplanet.management.service;

import com.darkplanet.management.dao.EmployeeDaoImp;
import com.darkplanet.management.domain.Employee;

import java.util.List;

public class EmployeeServiceImp implements IEmployeeService {
    EmployeeDaoImp employeeDao = new EmployeeDaoImp();

    @Override
    public Employee Login(String e_name, String e_pwd) {
        Employee employee = employeeDao.getEmployeeBYNamePwd(e_name, e_pwd);
        return employee;
    }

    @Override
    public Employee getEmployeeBYId(Integer employee_id) {
        return  employeeDao.getEmployeeById(employee_id);
    }

    @Override
    public List<Employee> getEmployees() {
        return employeeDao.getEmployees();
    }

    @Override
    public boolean addEmployee(String position, String e_name, String gender, Integer age, String phone, String work_date, String id_card, String remark) {
        employeeDao.addEmployee(position, e_name, gender, age, phone, work_date, id_card, remark);
        return false;
    }

    @Override
    public boolean deleteEmployee(Integer employee_id) {
        employeeDao.deleteEmployeeById(employee_id);
        return false;
    }

    @Override
    public boolean updateEmployee(String position, String e_name, String gender, Integer age, String phone, String work_date, String id_card, String remark, Integer employee_id) {
        employeeDao.updateEmployeeById(position, e_name, gender, age, phone, work_date, id_card, remark, employee_id);
        return true;
    }

    @Override
    public boolean uodatePwd(String e_pwd, String employee_id) {
        return false;
    }
}
